﻿using Demo01_Test.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls.Primitives;

namespace Demo01_Test.Controls
{
    public class DragThumb : Thumb
    {
        public DragThumb()
        {
            this.DragStarted += DragThumb_DragStarted;
            this.DragDelta += DragThumb_DragDelta;
            this.DragCompleted += DragThumb_DragCompleted;
        }

        SharpBase SharpBase
        {
            get { return this.DataContext as SharpBase; }
        }

        private void DragThumb_DragStarted(object sender, DragStartedEventArgs e)
        {

        }

        private void DragThumb_DragDelta(object sender, DragDeltaEventArgs e)
        {
            if (SharpBase != null)
            {
                SharpBase.Left += e.HorizontalChange;
                SharpBase.Top += e.VerticalChange;
            }
        }

        private void DragThumb_DragCompleted(object sender, DragCompletedEventArgs e)
        {

        }

    }
}
